package dmo3;

import java.util.Objects;

public  class Student implements Comparable {
    private String name;
    private String id;
    private int age;
    private int  grade;

    public Student() {
    }

    public Student(String name, String id, int age, int grade) {
        this.name = name;
        this.id = id;
        this.age = age;
        this.grade = grade;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public double getGrade() {
        return grade;
    }

    public void setGrade(int grade) {
        this.grade = grade;
    }

    @Override
    public int compare(Object obj) {
      Student c=(Student)obj;
      if (this.getGrade()>c.getGrade())
      {
          return 1;
      }
      else if (this.getGrade()==c.getGrade())
      {return 0;}
      else {
          return -1;
      }
    }



}
